package com.sias.swagger.exception;

import com.sias.swagger.common.ErrorCode;

/**
 * @author 吴文杰
 * @version 1.0
 * @createTime 2023-05-19 20:50:55
 */
public class BusinessException extends RuntimeException {

  private final int code;

  public int getCode() {
    return code;
  }

  public BusinessException(int code,String message) {
    super(message);
    this.code = code;
  }

  public BusinessException(ErrorCode errorCode) {
    super(errorCode.getMessage());
    this.code = errorCode.getCode();
  }

  public BusinessException(ErrorCode errorCode, String message) {
    super(message);
    this.code = errorCode.getCode();
  }


}
